<template>
    <h1>出生年份 --- {{ year }}</h1>

    <button @click="year++">修改年份</button>
    
    <h1>{{ msg1 }} --- {{ msg2 }}</h1>
</template>

<script>
export default {
    data() {
        return {
            year: 2005,
            msg1: '',
            msg2: ''
        };
    },  
    watch: {
        year () {
            document.body.style.backgroundColor = 'red'
        
            this.msg1 = 'msg1 展示'
            this.msg2 = 'msg2 展示'
        }
    } 
};
</script>

<style></style>
